// bsp4.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#define POTENZ 1000

int main(int argc, char* argv[])
{
	int i, j, summe;  
	int arr[303]; //302 is the length of the result of 2^1000

	//initArray
	for (j=0; j<303; j++){
		arr[j] = 0;
	}

	arr[0] = 1;
 
	for (i=1; i<=POTENZ; i++){
		for (j=0; j<303; j++){
			arr[j] <<= 1;  
		}

		for (j=0; j<303; j++){
			
			if (arr[j] >= 10){
				arr[j] -= 10; 
				arr[j+1] += 1; 
			}
		}
	}

	summe = 0;
	for (j=0; j<303; j++){
		summe += arr[j];
	}
 
	printf("Sum = %d", summe);

	getchar();
	return 0;
}

